﻿using System;
using System.Globalization;
using System.Windows.Data;
namespace CoreModule.Converters
{
    /// <summary>
    /// 长度百分比 转换。
    /// </summary>
    public class LengthScaleConverter : IValueConverter
    {
        public float Rate { get; set; } = 0.015f;
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double viewportWidth = (double)value;
            double baseFontSize = viewportWidth * Rate; // 10% of viewport width
            return baseFontSize;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
